<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class MlcmsNew extends Model
{
    protected $table="mlmcms_news";
    public $timestamps=false;
    protected $fillable = [];
    protected $guarded =[];
    //获取前N条新闻
    public static function getNewsLimt($limit) {
        $news = static::orderBy("Mn_UpdateTime",'DESC')->take($limit)->get();
        return $news;
    }
    //根据id获取信息信息
    public static function getNewById($id) {
        $new = static::where("MNID", $id)->first();
        return $new;
    }
    
    //格式化内容
    public function formatContent() {
        return htmlspecialchars_decode($this->Mn_Content);
    }
    
}
